﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;

namespace Habi.Solver.Models
{
    public enum NumberKind
    {
        T = 0,
        S = 1
    }
    public class IndexChartDataModel
    {
        public CharData Red { get; set; } = new CharData();
        public CharData Blue { get; set; } = new CharData();
    }

    public class CharData
    {
        public string[] Labels { get; set; }
        public int[] Numbers { get; set; }

        public List<RandomModel> ToList()
        {
            //int min = Numbers.Min();
            //int len = min.ToString().Length;
            //int b = Convert.ToInt32(Math.Pow(10, len - 2));

            List<RandomModel> models = new List<RandomModel>();
            for (int i = 0; i < Numbers.Length; i++)
            {
                RandomModel model = new RandomModel()
                {
                    Label = (i + 1).ToString(),
                    Count = Numbers[i]
                };
                models.Add(model);
            }

            return models;
        }
    }

    public class RandomModel
    {
        public string Label { get; set; }
        public int Count { get; set; }
    }

    public class RandomResult
    {
        public string Max { get; set; }
        public string Min { get; set; }
        public string Avg { get; set; }
        public string Type { get; set; }

        [DisplayFormat(DataFormatString = "MM-dd HH:mm:ss")]
        public DateTime Time { get; set; } = DateTime.Now;

        public override string ToString()
        {
            return $"Max: {Max}, Min: {Min}, Avg: {Avg}";
        }
    }
}
